package com.web.music.model;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Genre implements PersistentObject {

	@Id
	private Long id;
	
	private String name;

	public Genre() {
		super();
	}

	public Genre(Long id, String name) {
		super();
		this.id = id;
		this.name = name;
	}
	
	public String getName(){
		return name;
	}

	public void setName(String name ){
		this.name = name;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@Override
	public boolean equals(Object obj) {
		boolean result = true;
		if (obj instanceof Genre) {
			
			result = this.id.equals(((Genre) obj).getId())
						&& this.name.equals(((Genre) obj).getName());
			return result;
		}
		return false;
	}

	@Override
	public String toString() {
		return this.id + " " + this.name;
	}

	@Override
	public int hashCode() {
		return toString().hashCode();
	}	
}
